import http from '@/utils/request';

export interface DataItem {
  id: string
  taskName: string
  userNames: string
  taskTime: string
  createTime: string
  enabled: boolean
}
export const getTaskList = async (): Promise<{
  total: number;
  list: DataItem[];
}> => {
  const res: any = await http.get('/get-task-list')
  return res.message
}

export const updateTask = async (params: DataItem): Promise<boolean> => {
  const res: any = await http.post('/update-task', params)
  return res.message
}

export const deleteTaskById = async (id: string): Promise<boolean> => {
  const res: any = await http.get(`/delete-task-by-id?id=${id}`)
  return res.message
}


export const startTaskById = async (id: string): Promise<boolean> => {
  const res: any = await http.get(`/start-task-by-id?id=${id}`)
  return res.message
}

export const stopTaskById = async (id: string): Promise<boolean> => {
  const res: any = await http.get(`/stop-task-by-id?id=${id}`)
  return res.message
}



